<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <title>班级页面管理显示</title>
    <link href="/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<!--<hr>-->
<!--<h1>班级管理</h1>-->
<!--<hr>-->
<!--<button><a th:href = "@{/adm/clz/show}">显示所有的班级</a></button>-->
<div th:include="~{main/index :: nav}"></div>
<h1>课程管理</h1>
<hr>
<div style="display: flex;justify-content: space-around;">
    <div style="width: 60%;">
        <table class="table table-hover table-striped table-bordered" border="1" width="90%" style="text-align: center">
            <tr>
                <th>班级编号</th>
                <th>班级名称</th>
                <th>修改操作</th>
                <th>删除操作</th>
            </tr>
            <tr th:each="clz:${clzs}">
                <td th:text="${clz.clzno}"></td>
                <td th:text="${clz.clzname}"></td>
                <td><a th:href="'/adm/clz/go2update?clzno='+ ${clz.clzno} + '&curPage='+ ${curPage}"><button class="btn btn-warning">修改</button></a></td>
                <td><a th:href="@{'/adm/clz/delete?clzno='+ ${clz.clzno}} + '&curPage='+ ${curPage}"><button class="btn btn-warning">删除该课程</button></a> </td>
            </tr>
        </table>

        <p style="text-align: center">
            <a th:if="${curPage-1} ge 1"  th:href="@{'/adm/clz/prevPage?curPage='+ ${curPage-1}}">上一页</a>
            <a th:if="${curPage-1} lt 1"  th:href="@{'/adm/clz/prevPage?curPage=1'}">上一页</a>
            <span th:text="${curPage} +'/'+${totalPage}"/>
            <a th:if="${curPage+1} le ${totalPage}" th:href="@{'/adm/clz/nextPage?curPage='+ ${curPage+1}}">下一页</a>
            <a th:if="${curPage+1} gt ${totalPage}"  th:href="@{'/adm/clz/nextPage?curPage=' + ${totalPage}}">下一页</a>
        </p>
    </div>
    <div style="width: 38%;">
        <button><a th:href = "'/adm/clz/go2Add/'+${curPage}">添加一个新的班级</a></button>
        <hr>
        <form th:action="'/adm/clz/'+${action} + '?curPage='+ ${curPage}" method="post">
            <table class="table table-hover table-striped table-bordered table-row-cell">
                <tr>
                    <th style="width: 40%">课程编号：</th>
                    <td><input th:value="${clz.clzno}" type="text" name="clzno" th:readonly="${action eq 'update'}"></td>
                </tr>
                <tr>
                    <th style="width: 40%">课程名称：</th>
                    <td><input  th:value="${clz.clzname}" type="text"name="clzname"></td>
                </tr>
                <tr>
                    <th style="width: 40%"></th>
                    <td>
                        <button th:if="${action eq 'doAdd'}"  class="btn btn-warning">添加一个新课程</button>
                        <button th:if="${action eq 'update'}" class="btn btn-warning">修改课程</button>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>
<span th:text="${state}"></span>
</body>
</html>